package com.zr.serviceimpl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.zr.dao.ShowScopeDao;
import com.zr.model.Cdisstation;
import com.zr.service.ShowScopeService;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
@Service("showScopeServiceImpl")
public class ShowScopeServiceImpl implements ShowScopeService{
	@Resource
	private ShowScopeDao shscdai;
	@Override
	public JSONObject findScope(int page, int rows) {
		
		JSONObject jo=new JSONObject();
				
		List<Cdisstation> li=shscdai.getDisstation(page, rows);
		
		
		JSONArray ja=new JSONArray();
		for (Cdisstation cdisstation : li) {
			
			JSONObject j=new JSONObject();
			j.put("disid", cdisstation.getDisid());
			j.put("disname", cdisstation.getDisname());
			j.put("distypeid", cdisstation.getCstationtype().getDistype());
			j.put("cuser", cdisstation.getCuser().getUname());
			j.put("disscope", cdisstation.getDisscope());
			j.put("disprice", cdisstation.getDisprice());
			j.put("instation", cdisstation.getInstation());
			ja.add(j);
		}
		jo.put("total", shscdai.findStation());		 
		jo.put("rows", ja);
		
		return jo;
	}

	
	
}
